package xtu.www.viewinject;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

import android.util.Log;
import android.widget.Toast;


/**
 * Created by huilin on 2017/12/9.
 */

public class ProxyClass {

    public static <T> T proxyDo(Class<T> t) {
        return (T) Proxy.newProxyInstance(t.getClassLoader(),
                                          new Class[]{t},
                                          new InvocationHandler() {

                                              @Override
                                              public Object invoke(Object proxy, Method method,
                                                                   Object[] args)
                                                      throws Throwable {
                                                  Log.d("proxy","method_name = " + method
                                                          .getName());
                                                  return null;
                                              }
                                          });
    }

}
